home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / sysdeps / unix / sysv / fcntlbits.h < prev    next >
C/C++ Source or Header  |  1992-11-12  |  3KB  |  87 lines

  1. /* O_*, F_*, FD_* bit values for System V.
  2. Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4.  
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Library General Public License as
  7. published by the Free Software Foundation; either version 2 of the
  8. License, or (at your option) any later version.
  9.  
  10. The GNU C Library is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. Library General Public License for more details.
  14.  
  15. You should have received a copy of the GNU Library General Public
  16. License along with the GNU C Library; see the file COPYING.LIB.  If
  17. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  18. Cambridge, MA 02139, USA.  */
  19.  
  20. #ifndef    _FCNTLBITS_H
  21.  
  22. #define    _FCNTLBITS_H    1
  23.  
  24.  
  25. /* File access modes for `open' and `fcntl'.  */
  26. #define    O_RDONLY    0    /* Open read-only.  */
  27. #define    O_WRONLY    1    /* Open write-only.  */
  28. #define    O_RDWR        2    /* Open read/write.  */
  29.  
  30.  
  31. /* Bits OR'd into the second argument to open.  */
  32. #define    O_CREAT        00400    /* Create file if it doesn't exist.  */
  33. #define    O_EXCL        02000    /* Fail if file already exists.  */
  34. #define    O_TRUNC        01000    /* Truncate file to zero length.  */
  35. #if    defined (__USE_BSD) || defined (__USE_SVID)
  36. #define    O_SYNC        00020    /* Synchronous writes.  */
  37. #endif
  38.  
  39. /* File status flags for `open' and `fcntl'.  */
  40. #define    O_APPEND    000010    /* Writes append to the file.  */
  41. #define    O_NONBLOCK    000004    /* Non-blocking I/O.  */
  42.  
  43. #ifdef __USE_BSD
  44. /* System V doesn't support POSIX.1 O_NONBLOCK, but O_NDELAY is close.  */
  45. #define    O_NDELAY    O_NONBLOCK
  46. #endif
  47.  
  48. /* Mask for file access modes.  This is system-dependent in case
  49.    some system ever wants to define some other flavor of access.  */
  50. #define    O_ACCMODE    (O_RDONLY|O_WRONLY|O_RDWR)
  51.  
  52. /* Values for the second argument to `fcntl'.  */
  53. #define    F_DUPFD          0    /* Duplicate file descriptor.  */
  54. #define    F_GETFD        1    /* Get file descriptor flags.  */
  55. #define    F_SETFD        2    /* Set file descriptor flags.  */
  56. #define    F_GETFL        3    /* Get file status flags.  */
  57. #define    F_SETFL        4    /* Set file status flags.  */
  58. #define    F_GETLK        5    /* Get record locking info.  */
  59. #define    F_SETLK        6    /* Set record locking info.  */
  60. #define    F_SETLKW    7    /* Set record locking info, wait.  */
  61.  
  62. /* File descriptor flags used with F_GETFD and F_SETFD.  */
  63. #define    FD_CLOEXEC    1    /* Close on exec.  */
  64.  
  65.  
  66. #include <gnu/types.h>
  67.  
  68. /* The structure describing an advisory lock.  This is the type of the third
  69.    argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
  70. struct flock
  71.   {
  72.     short int l_type;    /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
  73.     short int l_whence;    /* Where `l_start' is relative to (like `lseek').  */
  74.     __off_t l_start;    /* Offset where the lock begins.  */
  75.     __off_t l_len;    /* Size of the locked area; zero means until EOF.  */
  76.     short int l_sysid;    /* System ID where locking process resides. */
  77.     short int l_pid;    /* Process holding the lock.  */
  78.   };
  79.  
  80. /* Values for the `l_type' field of a `struct flock'.  */
  81. #define    F_RDLCK    1    /* Read lock.  */
  82. #define    F_WRLCK    2    /* Write lock.  */
  83. #define    F_UNLCK    3    /* Remove lock.  */
  84.  
  85.  
  86. #endif    /* fcntlbits.h */
  87.